package org.secKill.util;

/**
 * @author 赵策
 * @category 数据库连接切换工具类
 * @param
 *
 */
public class JdbcContextHolder {
	
	private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();
	
	public static void setJdbcType(String jdbcType){
		contextHolder.set(jdbcType);
	}
	public static String getJdbcType(){
		return (String)contextHolder.get();
	}
	
	public static void setSlave(){
		setJdbcType("slave");
	}
	public static void setMaster(){
		clearJdbcType();
	}

	public static void clearJdbcType() {
		contextHolder.remove();
	}
	

}
